-----------------------------------------------------------------------
-- First Gadget from scratch!
--------------------------------

function gadget:GetInfo()             -- does this even work for Gadgets ...?
  return {
    name      = "nonControlledNoSelect",
    desc      = "Disallow players to mess with their factories - no stopping the Engine of War :P !",
    author    = "Sean Heron",
    date      = "September 2nd, 2009",
    license   = "GNU GPL, v2 or later",
    layer     = 1,
    enabled   = true
  }
end


---------
if (gadgetHandler:IsSyncedCode() == true) then               -- so why does this fuck me up ? well, I don't really give a damn, since it's all unsynced in here...  the opposite seems to be valid - not being able to select is synced ?

----------------------------------------------------------------------------------
----  SYNCED
----------------------------------------------------------------------------------

local landfactory = UnitDefNames.landfactory.id
local hunchback = UnitDefNames.hunchback.id

local unselectables = {                      -- might be easier to just define the selectables... (and do ~= below)
					landfactory,
					hunchback,
					}

function gadget:Update()
--	Spring.Echo("Hello Spring")
end


function gadget:UnitCreated(unitID, unitDefID, teamID)
	Spring.Echo("Unit created and checked for selection!")
	for _,nocontrol in pairs(unselectables) do
		if (unitDefID == nocontrol) then
		    Spring.SetUnitNoSelect (unitID,true)
		end
	end
end

end